package com.javaee.service.user.impl;
import com.javaee.entity.Board;
import com.javaee.entity.Doctor;
import com.javaee.mapper.admin.DoctorMapper;
import com.javaee.mapper.admin.UserMapper;
import com.javaee.mapper.user.IndexMapper;
import com.javaee.service.admin.UserService;
import com.javaee.service.user.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;

import java.util.List;

@Service
public class IndexServiceImpl implements IndexService {
    @Autowired
    private IndexMapper indexMapper;
    @Autowired
    private DoctorMapper doctorMapper;

    @Override
    public List<Doctor> showGoodDoctor(){
        return indexMapper.showGoodDoctor();
    }
    @Override
    public List<Board> showBoard(){
        return indexMapper.showBoard();
    }
    @Override
    public Doctor getDoctorById(int id){
        return indexMapper.getDoctorById(id);
    }
    @Override
    public Board getBoardById(int id){
        Board board= indexMapper.getBoardById(id);
        if(board!=null){
            indexMapper.increaseSeeCount(id);
        }
        return board;
    }
    }
